#include <openssl/ssl.h>

#include "details/sslConnection.hpp"

#if !defined( SSL_DATA_BUFF_SIZE )
#   define SSL_DATA_BUFF_SIZE   (2048)
#endif

sslSvrConnection ::buff_t
sslSvrConnection :: read()
{
	buff_t ret( SSL_DATA_BUFF_SIZE );
    int len = SSL_read(pt_ssl__.get(), ret.get(), SSL_DATA_BUFF_SIZE );

	if( len > 0 ){
		ret.dataLen( len );
	}
	return ret;
}

size_t sslSvrConnection :: send( buff_t buff )
{
    size_t ret = SSL_write( pt_ssl__.get() , buff.get() , buff.dataLen() );
	return ret;
}
